/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Bubblegum+Sans&display=swap');

body {
    font-family: 'Bubblegum Sans', 'Noto Sans', 'Noto Sans Tibetan', sans-serif;
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image: url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"%3E%3Cpath fill="%23ffffff" fill-opacity="0.3" d="M0,96L48,112C96,128,192,160,288,186.7C384,213,480,235,576,213.3C672,192,768,128,864,128C960,128,1056,192,1152,208C1248,224,1344,192,1392,176L1440,160L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"%3E%3C/path%3E%3C/svg%3E');
    background-position: bottom;
    background-repeat: no-repeat;
    background-size: 100% 30%;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 30px;
    margin: 20px auto;
    border: 8px solid #ffde59;
    position: relative;
    overflow: hidden;
}

/* 标题样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 4px dotted #ffde59;
    padding-bottom: 20px;
    position: relative;
}

header:after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background-color: #ffde59;
    border-radius: 50%;
    z-index: 1;
}

h1 {
    color: #ff6b6b;
    font-size: 3rem;
    margin-bottom: 5px;
    text-shadow: 3px 3px 0 #ffde59;
    letter-spacing: 2px;
}

h2 {
    color: #4a76a8;
    font-size: 1.4rem;
    font-weight: normal;
}

/* 游戏控制区域 */
.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 3px solid #e0e0e0;
}

.difficulty, .level-select {
    display: flex;
    align-items: center;
    margin-right: 15px;
    background-color: white;
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
}

label {
    margin-right: 10px;
    font-weight: bold;
    color: #4a76a8;
}

select, button {
    padding: 10px 18px;
    border-radius: 10px;
    border: 2px solid #ddd;
    background-color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Bubblegum Sans', sans-serif;
}

select:hover, button:hover {
    border-color: #ffde59;
}

button {
    background-color: #4a76a8;
    color: white;
    border: none;
    font-weight: bold;
    box-shadow: 0 4px 0 #3a5a78;
    position: relative;
    top: 0;
}

button:hover {
    background-color: #5a86b8;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #3a5a78;
}

button:active {
    top: 4px;
    box-shadow: 0 0 0 #3a5a78;
}

.moves, .timer {
    font-weight: bold;
    color: #ff6b6b;
    background-color: white;
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
    margin: 5px 0;
}

.timer {
    color: #4a76a8;
}

/* 游戏板样式 */
.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 12px;
    margin: 0 auto 30px;
    max-width: 500px;
    position: relative;
    padding: 20px;
    background-color: #f0f0f0;
    border-radius: 15px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.1);
    border: 5px solid #e0e0e0;
}



.tile {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #74ebd5 0%, #9face6 100%);
    border-radius: 12px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.1);
    color: #333;
    position: relative;
    overflow: hidden;
    border: 3px solid white;
}

.tile:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
    border-radius: 9px 9px 0 0;
}

.tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 11px 0 rgba(0, 0, 0, 0.1);
}

.tile:active {
    transform: translateY(5px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.tile.empty {
    background: transparent;
    box-shadow: none;
    cursor: default;
    border: 3px dashed #ccc;
}

.tile.empty:before {
    display: none;
}

.tile.correct {
    background: linear-gradient(135deg, #b7f8db 0%, #50a7c2 100%);
    color: #155724;
}

/* 藏文字体特殊样式 */
.tibetan-letter {
    font-family: 'Noto Sans Tibetan', sans-serif;
    font-size: 2.5rem;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

/* 特殊符号样式 */
.special-symbol {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

/* 消息区域 */
.message {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    border-radius: 15px;
    font-weight: bold;
    min-height: 70px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    font-size: 1.2rem;
    position: relative;
    overflow: hidden;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 3px solid #c3e6cb;
}

.message.success:before {
    content: '🎉';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 3px solid #bee5eb;
}

.message.info:before {
    content: '💡';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

/* 信息区域 */
.info-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 4px dotted #ffde59;
    position: relative;
}

.info-section:before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background-color: #ffde59;
    border-radius: 50%;
    z-index: 1;
}

.info-section h3 {
    margin-top: 25px;
    margin-bottom: 15px;
    color: #4a76a8;
    font-size: 1.6rem;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.05);
    position: relative;
    display: inline-block;
}

.info-section h3:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #ffde59;
    border-radius: 3px;
}

.info-section h4 {
    margin-bottom: 10px;
    color: #ff6b6b;
    font-size: 1.3rem;
}

.info-section p {
    line-height: 1.8;
    color: #555;
}

.level-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.level-item {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 3px solid #e0e0e0;
    transition: all 0.3s ease;
}

.level-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: #ffde59;
}

.level-item p {
    font-family: 'Noto Sans Tibetan', sans-serif;
    font-size: 1.1rem;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 30px;
    color: #777;
    font-size: 0.9rem;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.05);
    position: relative;
}

footer:before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background-color: #ffde59;
    border-radius: 50%;
}

/* 胜利弹窗 */
.victory-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

.victory-modal.show {
    display: flex;
}

.victory-content {
    background: linear-gradient(135deg, #fff9c4 0%, #ffeb3b 100%);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    position: relative;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 8px solid #ff6b6b;
    overflow: hidden;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.victory-title {
    color: #ff6b6b;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 3px 3px 0 #fff;
}

.victory-info {
    margin-bottom: 25px;
    font-size: 1.2rem;
    color: #4a76a8;
    font-weight: bold;
}

.victory-info p {
    margin: 10px 0;
}

.victory-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.victory-buttons button {
    padding: 12px 25px;
    font-size: 1.1rem;
    background-color: #4a76a8;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 0 #3a5a78;
    transition: all 0.2s ease;
    position: relative;
    top: 0;
}

.victory-buttons button:hover {
    background-color: #5a86b8;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #3a5a78;
}

.victory-buttons button:active {
    top: 4px;
    box-shadow: 0 0 0 #3a5a78;
}

/* 彩色纸屑动画 */
.confetti {
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.confetti:before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 10px;
    background-image:
        radial-gradient(circle, #ff6b6b 10px, transparent 10px),
        radial-gradient(circle, #4a76a8 15px, transparent 15px),
        radial-gradient(circle, #ffde59 7px, transparent 7px),
        radial-gradient(circle, #74ebd5 12px, transparent 12px);
    background-size: 40px 40px;
    animation: confettiFall 3s linear infinite;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes confettiFall {
    0% { background-position: 0 -10px, 20px -30px, 30px -15px, 10px -25px; }
    100% { background-position: 0 calc(100% + 10px), 20px calc(100% + 10px), 30px calc(100% + 10px), 10px calc(100% + 10px); }
}

/* 折叠式部分 */
.collapsible-section {
    margin: 20px 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.collapsible-header {
    background-color: #f0f0f0;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.collapsible-header:hover {
    background-color: #e0e0e0;
}

.collapsible-header h3 {
    margin: 0;
    color: #4a76a8;
}

.toggle-icon {
    font-size: 1.2rem;
    color: #4a76a8;
    transition: transform 0.3s ease;
}

.collapsible-section.active .toggle-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    background-color: white;
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.5s ease;
}

.collapsible-section.active .collapsible-content {
    max-height: 2000px; /* 足够大的值以容纳内容 */
    padding: 20px;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 2rem;
    }

    .game-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .tile {
        font-size: 1.5rem;
    }

    .tibetan-letter {
        font-size: 2rem;
    }

    .victory-title {
        font-size: 2rem;
    }

    .victory-content {
        padding: 20px;
    }

    .victory-buttons button {
        padding: 10px 20px;
        font-size: 1rem;
    }
}
